'use strict'

require('./nodeapp/logger')
require('./nodeapp/requestControl1')
require('./nodeapp/requestControl2')
//require('./nodeapp/requestControlTest')
require('./nodeapp/gateHandle')

let arenaComponent = require('./component/arenaComponent')
let playerSessionMgr = require('./core/playerSessionMgr')


let singintflag = 0
process.on('SIGINT', function() {
  if (singintflag === 0) {
    singintflag = 1
    console.log('SIGINT')
    arenaComponent.saveArena()
    playerSessionMgr.savePlayer()
    setTimeout(function() {
      process.exit(0)
    }, 3000)
  }
})

process.on('exit', function(code) {
  console.log('process exit')
})

/*
process.on('uncaughtException', function(err) {
  console.log('Caught exception: ' + err)
  process.exit(0)
})*/
